﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Saper
{
    public partial class Options : Form

    {
        Form1 form;
        public Options(Form1 form)
        {
            InitializeComponent();
            this.form = form;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            Enable(false);
        }

        private void button1_Click(object sender, EventArgs e)
        {

            if (newbie.Checked)
                form.ChangeOptions(8, 8, 10,Difficulty.NEWBIE);
            if (amator.Checked)
                form.ChangeOptions(12, 12, 20, Difficulty.AMATOR);
            if (profi.Checked)
                form.ChangeOptions(15, 15, 40, Difficulty.PROFI);
            if (special.Checked)
                form.ChangeOptions(Convert.ToInt32(widthSpecial.Text), Convert.ToInt32(heightSpecial.Text), Convert.ToInt32(textBox1.Text), Difficulty.SPECIAL);

            
            Close();
        }

        private void Enable(bool b)
        {
            groupBox2.Enabled = b;
        
        }

        private void special_CheckedChanged(object sender, EventArgs e)
        {
            Enable(true);
        }

        private void newbie_CheckedChanged(object sender, EventArgs e)
        {
            Enable(false);
        }

        private void profi_CheckedChanged(object sender, EventArgs e)
        {
            Enable(false);
        }

        private void Options_Load(object sender, EventArgs e)
        {

            switch (Form1.difficulty)
            {

                case Difficulty.NEWBIE:
                    newbie.Checked = true;
                    break;
                case Difficulty.AMATOR:
                    amator.Checked = true;
                    break;
                case Difficulty.PROFI:
                    profi.Checked = true;
                    break;
                case Difficulty.SPECIAL:
                    special.Checked = true;
                    break;
                default:
                    break;
            }
            Enable(special.Checked);
        }
    }
}
